using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace Brick
{
	public class gdk_pageView_mask : MonoBehaviour
	{
		public ToggleGroup toggleGroup;

		public Toggle togglePrefab;

		public gdk_pageView pageView;

		public int count = 1;

		private List<Toggle> toggleList = new List<Toggle>();

		private void OnScrollPageChanged(int currentPageIndex)
		{
			if (currentPageIndex >= 0)
			{
				toggleList[currentPageIndex].isOn = true;
			}
		}

		private Toggle CreateToggle()
		{
			Toggle toggle = UnityEngine.Object.Instantiate(togglePrefab);
			toggle.gameObject.SetActive(value: true);
			toggle.transform.SetParent(toggleGroup.transform);
			toggle.transform.localScale = Vector3.one;
			toggle.transform.localPosition = Vector3.zero;
			return toggle;
		}

		private void Start()
		{
			for (int i = 0; i < count; i++)
			{
				toggleList.Add(CreateToggle());
			}
			pageView.OnPageChanged = OnScrollPageChanged;
			OnScrollPageChanged(0);
		}

		private void Update()
		{
		}
	}
}

